package com.qf.resp;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultEntity {

    private static final String SUCCESS = "success";

    private static final String ERROR = "error";

    private String status;

    private Integer code;

    private String msg;

    public ResultEntity(String success, int i, Object o) {
    }


    public static ResultEntity success(){
        return new ResultEntity(SUCCESS,200,null);
    }

    public static ResultEntity success(Boolean flag){
        if (flag){
            return success();
        }else {
            return error("数据有误");
        }
    }


    public static ResultEntity error(String msg){
        return new ResultEntity(ERROR,500,msg);
    }


}
